package com.knowif.backend.controller;

import org.springframework.stereotype.Component;

import javax.websocket.OnMessage;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;

/**
 * @author ：Xh
 * @date ：Created in 2019/5/30 0030 22:17
 */
@ServerEndpoint("/websocket/{userId}/{orderId}")
@Component
public class WebSocketServer {

    @OnMessage
    public void onMessage(String message,Session session) throws IOException {
//        webSocketSet.stream()
//                .filter(e->e.to.equals(this.to)&&e!=this)
//                .forEach(e-> {
//                    try {
//                        e.session.getBasicRemote()
//                                .sendText(FastJsonUtils
//                                        .toJSONString(new Server2ClientMessage(message,new Date(),1)));
//                    } catch (IOException e1) {
//                        e1.printStackTrace();
//                    }
//                });

    }
}
